package com.margiel.rozkladowka.model;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections.map.LinkedMap;

import com.margiel.util.StringUtil;

public class TimeTable {
	private String sourceStop;
	private String destinationStop;
	private String directionLink;
	private List<Stop> stops; 


	public String getSourceStop() {
		return sourceStop;
	}

	public void setSourceStop(String sourceStop) {
		this.sourceStop = sourceStop;
	}

	public String getDestinationStop() {
		return destinationStop;
	}

	public void setDestinationStop(String destinationStop) {
		this.destinationStop = destinationStop;
	}

	public String getDirectionLink() {
		return directionLink;
	}

	public void setDirectionLink(String directionLink) {
		this.directionLink = directionLink;
	}

	public TimeTable(String sourceStop, String destinationStop, String directionLink) {
		super();
		this.sourceStop = sourceStop;
		this.destinationStop = destinationStop;
		this.directionLink = directionLink;
	}

	public void addStop(Stop stop){
		if (stops == null){
			stops = new ArrayList<Stop>();
		}
		stops.add(stop);
	}
	
	public List<Stop> getStops() {
		return stops;
	}

	public void setStops(List<Stop> stops) {
		this.stops = stops;
	}

	/**
	 * Constructs a <code>String</code> with all attributes
	 * in name = value format.
	 *
	 * @return a <code>String</code> representation 
	 * of this object.
	 */
	public String toString()
	{
	    final String TAB = "]\n    ";
	    final String END = "]\n";
	    
	    String retValue = "";
	    
	    retValue = "TimeTable ( "
	        + super.toString() + TAB
	        + "sourceStop = [" + this.sourceStop + TAB
	        + "destinationStop = [" + this.destinationStop + TAB
	        + "directionLink = [" + this.directionLink + TAB
	        + "TimeTables = " + StringUtil.collectionToString(this.stops) + END
	        + " )";
	
	    return retValue;
	}


}
